package com.doucat.support.dialog;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.doucat.support.view.CatButton;
import com.doucat.support.view.CatTextView;
import com.tonly.doucatlibrary.R;


/**
 * -----------------------------------------------------------------
 * Copyright (C) 2014-2016, by your company, All rights reserved.
 * -----------------------------------------------------------------
 * File: LoadingDialog.java
 * Author: win7
 * Version: V100R001C01
 * Create: 2019/6/12 16:02
 * Changes (from 2019/6/12)
 * -----------------------------------------------------------------
 * 2019/6/12 : Create LoadingDialog.java (win7);
 * -----------------------------------------------------------------
 *
 * AlertDialog替代品，利用base的隐藏导航栏
 */
public class TipDialog extends BaseDialog {

    private CatTextView tvTitle;
    private CatButton btnRight;
    @Override
    public View onLoadLayout(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.layout_dialog_tip, null);
        tvTitle =view.findViewById(R.id.tvTitle);
        btnRight=view.findViewById(R.id.btnRight);
        if(rightString==null){
            rightString=getString(R.string.enter);
        }
        if(rightClickListener==null){
            rightClickListener=new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dismiss();
                }
            };
        }

        tvTitle.setText(title);
        btnRight.setText(rightString);
        btnRight.setOnClickListener(rightClickListener);
        return view;
    }

    private CharSequence rightString;
    private View.OnClickListener rightClickListener;
    public TipDialog setRightButton(CharSequence text, final View.OnClickListener listener) {
        this.rightString =text;
        this.rightClickListener =listener;
        return this;
    }

    private CharSequence title;
    public TipDialog setTitle(CharSequence title) {
        this.title=title;
        return this;
    }
}
